package cn.topkinson.rabbitmq.dead.queue.service;

import cn.topkinson.rabbitmq.dead.queue.config.RabbitConfig;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.UUID;

/**
 * @Author huangzihao
 * @Date 2020/12/26 19:45
 */
@Service
public class OrderService {

    @Autowired
    private AmqpTemplate amqpTemplate;

    public String order() {
        String orderNo =  UUID.randomUUID().toString();
        amqpTemplate.convertAndSend(RabbitConfig.EX_PAY, RabbitConfig.KEY_PAY, orderNo);
        return orderNo;
    }
}
